﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;

namespace LightSwitchApplication
{
    public partial class CreateEditSalesOrder
    {
        partial void CreateEditSalesOrder_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            // Write your code here.
            if (this.OrderId.HasValue)
            {
                this.SalesOrderProperty = this.SalesOrder;
                this.DisplayName = "Заказ - " + this.SalesOrderProperty.ShopName;
            }
            else
            {
                this.SalesOrderProperty = new SalesOrder();
                this.DisplayName = "Новый заказ";
                //this.SalesOrderProperty.Country = this.Countries.First();
            }

        }

        partial void CreateEditSalesOrder_Saved()
        {
            // Write your code here.
            this.Close(false);
            Application.Current.ShowDefaultScreen(this.SalesOrderProperty);
        }
    }
}